package com.evil.account.api;

import com.evil.account.config.AccountFeignErrorDecoder;
import com.evil.common.account.dto.FindByIdAndEIdReqDTO;
import com.evil.common.account.dto.department.DepartmentBaseRespDTO;
import com.evil.common.account.dto.user.UserBaseRespDTO;
import com.evil.common.account.dto.user.UserEnterpriseBaseDTO;
import com.evil.common.account.dto.user.department.DepartmentManagersReqDTO;
import com.evil.common.account.dto.user.department.DepartmentManagersRespDTO;
import com.evil.common.account.dto.user.department.DeptUsersReqDTO;
import com.evil.common.account.dto.user.department.UserDeptManageReqDTO;
import com.evil.common.family.constant.ServiceNameConstant;
import com.evil.common.family.dto.FindByIdReqDTO;
import com.evil.common.family.dto.FindByIdsReqDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

/**
 * 部门接口
 *
 * @author liyang
 * @date 2022-08-08 00:00
 */
@FeignClient(name = ServiceNameConstant.ACCOUNT_SERVICE, configuration = {AccountFeignErrorDecoder.class})
public interface RemoteUserDepartmentService {

    /**
     * 获取指定部门 用户ids
     *
     * @param findByIdReqDTO findByIdReqDTO
     * @return userIds
     */
    @PostMapping("/remote/user/department/user-ids-by-dept-id")
    List<Long> findUserIdsByDeptId(@Validated @RequestBody FindByIdReqDTO findByIdReqDTO);

    /**
     * 获取指定部门 用户基础信息列表
     *
     * @param findByIdsReqDTO findByIdsReqDTO
     * @return userIds
     */
    @PostMapping("/remote/user/department/user-bases-by-dept-ids")
    List<UserBaseRespDTO> findUserBasesByDeptIds(@Validated @RequestBody FindByIdsReqDTO findByIdsReqDTO);

    /**
     * 获取指定部门 用户ids
     *
     * @param findByIdsReqDTO findByIdsReqDTO
     * @return userIds
     */
    @PostMapping("/remote/user/department/user-ids-by-dept-ids")
    List<Long> findUserIdsByDeptIds(@Validated @RequestBody FindByIdsReqDTO findByIdsReqDTO);

    /**
     * 获取用户部门列表
     *
     * @param findByIdAndEIdReqDTO findByIdAndEIdReqDTO
     * @return deptIds
     */
    @PostMapping("/remote/user/department/list")
    List<Long> findUserDepartmentByUserIds(@Validated @RequestBody FindByIdAndEIdReqDTO findByIdAndEIdReqDTO);

    /**
     * 登录用户部门基础信息
     *
     * @return DepartmentBaseRespDTO 列表
     */
    @PostMapping("/remote/login-user-departments")
    List<DepartmentBaseRespDTO> loginUserDepartmentBases();

    /**
     * 用户部门基础信息
     *
     * @param userEnterpriseDTO userEnterpriseDTO
     * @return DepartmentBaseRespDTO 列表
     */
    @PostMapping("/remote/user-department-bases")
    List<DepartmentBaseRespDTO> userDepartmentBases(@Validated @RequestBody UserEnterpriseBaseDTO userEnterpriseDTO);

    /**
     * 部门负责人列表
     *
     * @param departmentManagersReqDTO departmentManagersReqDTO
     * @return DepartmentManagersRespDTO
     */
    @PostMapping("/remote/user/department/manager/list")
    DepartmentManagersRespDTO departmentManagerList(@Validated @RequestBody DepartmentManagersReqDTO departmentManagersReqDTO);

    /**
     * 配置部门主管（单个用户）
     *
     * @param userDeptManageReqDTO userDeptManageReqDTO
     */
    @PostMapping("/remote/user/department/manager")
    void userDepartmentManager(@Validated @RequestBody UserDeptManageReqDTO userDeptManageReqDTO);

    /**
     * 部门批量删除用户
     *
     * @param deptUsersReqDTO deptUsersReqDTO
     */
    @PostMapping("/remote/user/department/batch-delete")
    void deleteUserDepartmentBatch(@Validated @RequestBody DeptUsersReqDTO deptUsersReqDTO);

    /**
     * 部门批量新增用户
     *
     * @param deptUsersReqDTO deptUsersReqDTO
     */
    @PostMapping("/remote/user/department/batch-add")
    void addUserDepartmentBatch(@Validated @RequestBody DeptUsersReqDTO deptUsersReqDTO);
}
